package cn.test;

public class Sum {
	public static void main(String[] args) {
		long a=1234;
		sumDigits(a);
		
		
	}
	public static int sumDigits (long n) {
		int sum=0;
		
		while(n!=0) {
			sum+=n%10;
			n/=10;
			
		}
		
		
	System.out.println(sum);
		
		
		
		return 0;
		
	}
}
